#pragma once

#include "condition.h"


namespace BAA
{

	class Action_Run:public Action
	{
	public:


		Action_Run(const std::string name, Vector2 * range):Action(name)
		{
			mRange.x = range->x;
			mRange.y = range->y;

			mAngerFactor = 0.6f;
			mFearFactor = 0.6f;
			mPhysicalExerciseFactor = 0.9f;
		}


		virtual void PrepareConditions()
		{
			// nothing to do to run.
		}

		virtual float CalculateStateUtility()
		{
			AgentProperties * properties = mRoleParent->Self()->Properties();

			// run when very scared, or angry, or really needing exersise
			return MathHelper::clamp(&mRange,( 
				abs(mAngerFactor - properties->mAnger->GetValue()) +
				abs(mFearFactor  - properties->mFear->GetValue())  +
				abs(mPhysicalExerciseFactor - properties->mPhysicalExercise->Value())));
			
		}






		~Action_Run()
		{

		}

	protected:
		// any members

		Vector2 mRange;

		float mAngerFactor;
		float mFearFactor;
		float mPhysicalExerciseFactor;
	};// end class
}// end namespace
